<!DOCTYPE html>
<html style="width: 100%; height: 100%;">
<head lang="en">
    <meta charset="UTF-8">
    <title>内蒙古移动后台管理</title>
    <link type="text/css" rel="stylesheet" href="/resources/easyui/themes/default/easyui.css">
    <link type="text/css" rel="stylesheet" href="/resources/easyui/themes/color.css">
    <link type="text/css" rel="stylesheet" href="/resources/easyui/themes/icon.css">
    <style type="text/css">
        .center{
            text-align: center;
        }
    </style>
    <script type="text/javascript" src="/resources/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="/resources/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/resources/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="/resources/easyui/plugin/jquery.cookie.js"></script>
    <script type="text/javascript" src="/resources/js/Util.js"></script>
    <script type="text/javascript">
        function onLoad() {
            if(isLogon()){
                setHeader();
                setMenu();
            }
        }

        function setHeader(){
            restClient('/rest/admin/session', function(data){
                $.cookie("managerId", data.managerId);
                $.cookie("managerName", data.managerName);
                $.cookie("roleId", data.roleId);
                $.cookie("roleName", data.roleName);
                $.cookie("roleLevel", data.roleLevel);
                $.cookie("appId", data.appId);

                $('#headerTitle').panel({
                    title: "欢迎"+data.roleName+"【"+data.managerName+"】"
                });
            });
        }

        function setMenu(){
            restClient('/rest/menu/show', function(data){
                $('#menu').tree('loadData', data);
            });
        }

        $(function(){

        });
    </script>
</head>
<body style="width: 100%; height: 100%; margin: 0;" onload="onLoad();">
<div id="cc" class="easyui-layout" style="width:100%;height:100%;">
    <div id="headerTitle" class="easyui-layout" data-options="region:'north',title:'欢迎',collapsible:false" style="height:110px;">
        <div data-options="region:'center',border:false" style="overflow: hidden; background: url(resources/img/index-header-bg.png) repeat-x;">
            <img src="resources/img/logo.png">
        </div>
        <div data-options="region:'east',border:false" style="width: 70px;background: url(resources/img/index-header-bg.png) repeat-x;">
            <a class="easyui-linkbutton" data-options="iconCls:'icon-back'" onclick="logout()">退出</a>
        </div>
    </div>
    <div data-options="region:'south',title:'copyright2014 内蒙古移动',collapsible:false" headerCls="center"></div>
    <div data-options="region:'west',title:'导航菜单',split:true" style="width:150px;">
        <ul id="menu" class="easyui-tree" data-options="animate:true"></ul>
    </div>
    <div id="centerTitle" data-options="region:'center',title:'首页'" style="overflow:hidden;">
        <iframe id="centerFrame" scrolling="auto" frameborder="0" style="width:100%;height:100%;"></iframe>
    </div>
</div>
</body>
<script type="text/javascript">
    function logout(){
        restClient('/rest/admin/logout', function(){
            cleanCookie();
        });
        location.href = 'login.html';
    }
    $('#menu').tree({
        onClick:function(node){
            if($('#menu').tree('isLeaf', node.target)){
                $('#centerTitle').panel({
                    title:node.text
                });
                $('#centerFrame').attr('src', node.attributes.url);
            }
        }
    })
</script>
</html>